from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep
from postion import options
from postion import service

driver = webdriver.Chrome(options=options,service=service)
driver.get(r'https://www.baidu.com/')
driver.maximize_window()
sleep(3)

driver.find_element(By.ID,'s-usersetting-top').click()
sleep(1)
driver.find_element(By.LINK_TEXT,'搜索设置').click()
sleep(1)
driver.find_element(By.LINK_TEXT,'保存设置').click()
sleep(3)

#处理弹窗
text=driver.switch_to.alert.text
print(text)
sleep(3)

#点击确定
driver.switch_to.alert.accept()
sleep(3)

driver.quit()